<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>kalman-cpp: KF Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">kalman-cpp
   </div>
   <div id="projectbrief">Implementation of Kalman Filter in C++</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('class_k_f.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_k_f-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">KF Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Kalman filter implementation, for a linear system.  
 <a href="class_k_f.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="kf_8h_source.html">kf.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac6906ac2754b4ef3f79f45a5b7886fdd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#ac6906ac2754b4ef3f79f45a5b7886fdd">KF</a> ()</td></tr>
<tr class="memdesc:ac6906ac2754b4ef3f79f45a5b7886fdd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor, nothing happens here.  <a href="class_k_f.html#ac6906ac2754b4ef3f79f45a5b7886fdd">More...</a><br /></td></tr>
<tr class="separator:ac6906ac2754b4ef3f79f45a5b7886fdd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af37a2d3ac0119750e546a895d9e2f279"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#af37a2d3ac0119750e546a895d9e2f279">~KF</a> ()</td></tr>
<tr class="memdesc:af37a2d3ac0119750e546a895d9e2f279"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor, nothing happens here.  <a href="class_k_f.html#af37a2d3ac0119750e546a895d9e2f279">More...</a><br /></td></tr>
<tr class="separator:af37a2d3ac0119750e546a895d9e2f279"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a890367dd9a8888a2ea8bda296b6128dd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#a890367dd9a8888a2ea8bda296b6128dd">InitSystem</a> (const mat &amp;A, const mat &amp;B, const mat &amp;H, const mat &amp;Q, const mat &amp;R)</td></tr>
<tr class="memdesc:a890367dd9a8888a2ea8bda296b6128dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the system.  <a href="class_k_f.html#a890367dd9a8888a2ea8bda296b6128dd">More...</a><br /></td></tr>
<tr class="separator:a890367dd9a8888a2ea8bda296b6128dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a5efd881097162ae3d76cae2f31da4f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#a4a5efd881097162ae3d76cae2f31da4f">InitSystemState</a> (const colvec &amp;x0)</td></tr>
<tr class="memdesc:a4a5efd881097162ae3d76cae2f31da4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the system states. Must be called after InitSystem. If not, called, system states are initialized to zero.  <a href="class_k_f.html#a4a5efd881097162ae3d76cae2f31da4f">More...</a><br /></td></tr>
<tr class="separator:a4a5efd881097162ae3d76cae2f31da4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a351b7f3cea3e81b82c832eb901d7b4bb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#a351b7f3cea3e81b82c832eb901d7b4bb">InitStateCovariance</a> (const mat &amp;P0)</td></tr>
<tr class="memdesc:a351b7f3cea3e81b82c832eb901d7b4bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the state covariance. Must be called after InitSystem. If not called, covariance state is Initialized to an identity matrix.  <a href="class_k_f.html#a351b7f3cea3e81b82c832eb901d7b4bb">More...</a><br /></td></tr>
<tr class="separator:a351b7f3cea3e81b82c832eb901d7b4bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc63e676e77b8a6b1ccbb88dec545d99"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#acc63e676e77b8a6b1ccbb88dec545d99">Kalmanf</a> (const colvec &amp;u)</td></tr>
<tr class="memdesc:acc63e676e77b8a6b1ccbb88dec545d99"><td class="mdescLeft">&#160;</td><td class="mdescRight">Do Kalman filter iteration step-by-step while simulating the system. Simulating the system is done to calculate system states and outputs.  <a href="class_k_f.html#acc63e676e77b8a6b1ccbb88dec545d99">More...</a><br /></td></tr>
<tr class="separator:acc63e676e77b8a6b1ccbb88dec545d99"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf29802c32e4c31adb9a3b4cdfa4eee7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#acf29802c32e4c31adb9a3b4cdfa4eee7">Kalmanf</a> (const colvec &amp;z, const colvec &amp;u)</td></tr>
<tr class="memdesc:acf29802c32e4c31adb9a3b4cdfa4eee7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Do Kalman filter iteration step-by-step without simulating the system. Use this if measurement is available and simulating the system is unnecessary. Here, true system states and system outputs do not matter. The only thing that matters is the estimated states.  <a href="class_k_f.html#acf29802c32e4c31adb9a3b4cdfa4eee7">More...</a><br /></td></tr>
<tr class="separator:acf29802c32e4c31adb9a3b4cdfa4eee7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a09da06a7f21b8d449833a0a9f130292a"><td class="memItemLeft" align="right" valign="top">colvec *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#a09da06a7f21b8d449833a0a9f130292a">GetCurrentState</a> ()</td></tr>
<tr class="memdesc:a09da06a7f21b8d449833a0a9f130292a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current simulated true state.  <a href="class_k_f.html#a09da06a7f21b8d449833a0a9f130292a">More...</a><br /></td></tr>
<tr class="separator:a09da06a7f21b8d449833a0a9f130292a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ec9ee4dc0e5435a2ca9e1d2787c3e9c"><td class="memItemLeft" align="right" valign="top">colvec *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#a8ec9ee4dc0e5435a2ca9e1d2787c3e9c">GetCurrentOutput</a> ()</td></tr>
<tr class="memdesc:a8ec9ee4dc0e5435a2ca9e1d2787c3e9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current simulated true output. This is analogous to the measurements.  <a href="class_k_f.html#a8ec9ee4dc0e5435a2ca9e1d2787c3e9c">More...</a><br /></td></tr>
<tr class="separator:a8ec9ee4dc0e5435a2ca9e1d2787c3e9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abcfd6d77410e71d6df11f356ac49e6b7"><td class="memItemLeft" align="right" valign="top">colvec *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#abcfd6d77410e71d6df11f356ac49e6b7">GetCurrentEstimatedState</a> ()</td></tr>
<tr class="memdesc:abcfd6d77410e71d6df11f356ac49e6b7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current estimated state.  <a href="class_k_f.html#abcfd6d77410e71d6df11f356ac49e6b7">More...</a><br /></td></tr>
<tr class="separator:abcfd6d77410e71d6df11f356ac49e6b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5766b144d9d9d4ff395ed546e6071b76"><td class="memItemLeft" align="right" valign="top">colvec *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_k_f.html#a5766b144d9d9d4ff395ed546e6071b76">GetCurrentEstimatedOutput</a> ()</td></tr>
<tr class="memdesc:a5766b144d9d9d4ff395ed546e6071b76"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current estimated output. This is the filtered measurements, with less noise.  <a href="class_k_f.html#a5766b144d9d9d4ff395ed546e6071b76">More...</a><br /></td></tr>
<tr class="separator:a5766b144d9d9d4ff395ed546e6071b76"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Kalman filter implementation, for a linear system. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ac6906ac2754b4ef3f79f45a5b7886fdd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac6906ac2754b4ef3f79f45a5b7886fdd">&#9670;&nbsp;</a></span>KF()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">KF::KF </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor, nothing happens here. </p>

</div>
</div>
<a id="af37a2d3ac0119750e546a895d9e2f279"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af37a2d3ac0119750e546a895d9e2f279">&#9670;&nbsp;</a></span>~KF()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">KF::~KF </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destructor, nothing happens here. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a5766b144d9d9d4ff395ed546e6071b76"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5766b144d9d9d4ff395ed546e6071b76">&#9670;&nbsp;</a></span>GetCurrentEstimatedOutput()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">colvec * KF::GetCurrentEstimatedOutput </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current estimated output. This is the filtered measurements, with less noise. </p>
<dl class="section return"><dt>Returns</dt><dd>Current estimated output $\hat{z}_k$ </dd></dl>

</div>
</div>
<a id="abcfd6d77410e71d6df11f356ac49e6b7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abcfd6d77410e71d6df11f356ac49e6b7">&#9670;&nbsp;</a></span>GetCurrentEstimatedState()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">colvec * KF::GetCurrentEstimatedState </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current estimated state. </p>
<dl class="section return"><dt>Returns</dt><dd>Current estimated state $\hat{x}_k$ </dd></dl>

</div>
</div>
<a id="a8ec9ee4dc0e5435a2ca9e1d2787c3e9c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ec9ee4dc0e5435a2ca9e1d2787c3e9c">&#9670;&nbsp;</a></span>GetCurrentOutput()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">colvec * KF::GetCurrentOutput </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current simulated true output. This is analogous to the measurements. </p>
<dl class="section return"><dt>Returns</dt><dd>Current simulated output $z_k$ </dd></dl>

</div>
</div>
<a id="a09da06a7f21b8d449833a0a9f130292a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a09da06a7f21b8d449833a0a9f130292a">&#9670;&nbsp;</a></span>GetCurrentState()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">colvec * KF::GetCurrentState </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current simulated true state. </p>
<dl class="section return"><dt>Returns</dt><dd>Current simulated state $x_k$ </dd></dl>

</div>
</div>
<a id="a351b7f3cea3e81b82c832eb901d7b4bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a351b7f3cea3e81b82c832eb901d7b4bb">&#9670;&nbsp;</a></span>InitStateCovariance()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KF::InitStateCovariance </td>
          <td>(</td>
          <td class="paramtype">const mat &amp;&#160;</td>
          <td class="paramname"><em>P0</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the state covariance. Must be called after InitSystem. If not called, covariance state is Initialized to an identity matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">P0</td><td>Inital value for the state covariance </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a890367dd9a8888a2ea8bda296b6128dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a890367dd9a8888a2ea8bda296b6128dd">&#9670;&nbsp;</a></span>InitSystem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KF::InitSystem </td>
          <td>(</td>
          <td class="paramtype">const mat &amp;&#160;</td>
          <td class="paramname"><em>A</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const mat &amp;&#160;</td>
          <td class="paramname"><em>B</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const mat &amp;&#160;</td>
          <td class="paramname"><em>H</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const mat &amp;&#160;</td>
          <td class="paramname"><em>Q</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const mat &amp;&#160;</td>
          <td class="paramname"><em>R</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Define the system. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">A</td><td>System matrix </td></tr>
    <tr><td class="paramname">B</td><td>Input matrix </td></tr>
    <tr><td class="paramname">H</td><td>Output matrix </td></tr>
    <tr><td class="paramname">Q</td><td>Process noise covariance </td></tr>
    <tr><td class="paramname">R</td><td>Measurement noise covariance </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a4a5efd881097162ae3d76cae2f31da4f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a5efd881097162ae3d76cae2f31da4f">&#9670;&nbsp;</a></span>InitSystemState()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KF::InitSystemState </td>
          <td>(</td>
          <td class="paramtype">const colvec &amp;&#160;</td>
          <td class="paramname"><em>x0</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the system states. Must be called after InitSystem. If not, called, system states are initialized to zero. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x0</td><td>Inital value for the system state </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="acc63e676e77b8a6b1ccbb88dec545d99"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acc63e676e77b8a6b1ccbb88dec545d99">&#9670;&nbsp;</a></span>Kalmanf() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KF::Kalmanf </td>
          <td>(</td>
          <td class="paramtype">const colvec &amp;&#160;</td>
          <td class="paramname"><em>u</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Do Kalman filter iteration step-by-step while simulating the system. Simulating the system is done to calculate system states and outputs. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">u</td><td>tThe applied input to the system </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="acf29802c32e4c31adb9a3b4cdfa4eee7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acf29802c32e4c31adb9a3b4cdfa4eee7">&#9670;&nbsp;</a></span>Kalmanf() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void KF::Kalmanf </td>
          <td>(</td>
          <td class="paramtype">const colvec &amp;&#160;</td>
          <td class="paramname"><em>z</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const colvec &amp;&#160;</td>
          <td class="paramname"><em>u</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Do Kalman filter iteration step-by-step without simulating the system. Use this if measurement is available and simulating the system is unnecessary. Here, true system states and system outputs do not matter. The only thing that matters is the estimated states. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">z</td><td>The values of the output from measurement </td></tr>
    <tr><td class="paramname">u</td><td>The applied input to the system </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>kalman/<a class="el" href="kf_8h_source.html">kf.h</a></li>
<li>kalman/<a class="el" href="kf_8cpp.html">kf.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="class_k_f.html">KF</a></li>
    <li class="footer">Generated on Thu Apr 1 2021 04:15:37 for kalman-cpp by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
  </ul>
</div>
</body>
</html>
